<?php
$this->_toolbar = array(
		'title'		=>	Yii::t('admin_poll', 'View Poll').' #'.GxHtml::encode($model->title),
		'buttons'	=>	array(
			CHtml::link(Yii::t('admin_poll', 'Export Poll'), Yii::app()->createUrl('/admin_poll/poll/export',array('id'=>$model->id)), array('class'=>'button-s')),
			CHtml::link(Yii::t('admin_poll', 'Update Poll'), Yii::app()->createUrl('/admin_poll/poll/update',array('id'=>$model->id)), array('class'=>'button-s')),
			CHtml::link(Yii::t('admin_poll', 'Delete Poll'), "", array(
				'submit'	=>	Yii::app()->createUrl('/admin_poll/poll/delete',array('command'=>'delete','id'=>$model->id)),
				'confirm'	=>	Yii::t('admin_poll','Are you sure you want to delete item?'),
				'class'		=>	'button-s del'
			)),
		)
);
?>

<h1><?php echo CHtml::encode($model->title); ?></h1>

<?php if ($model->description): ?>
<p class="description"><?php echo CHtml::encode($model->description); ?></p>
<?php endif; ?>

<?php $this->renderPartial('_results', array('model' => $model)); ?>

<?php if ($userVote->id): ?>
  <p id="pollvote-<?php echo $userVote->id ?>">
    You voted: <strong><?php echo $userChoice->label ?></strong>.<br />
    <?php
      if ($userCanCancel) {
        echo CHtml::ajaxLink(
          'Cancel Vote',
          array('/poll/pollvote/delete', 'id' => $userVote->id, 'ajax' => TRUE),
          array(
            'type' => 'POST',
            'success' => 'js:function(){window.location.reload();}',
          ),
          array(
            'class' => 'cancel-vote',
            'confirm' => 'Are you sure you want to cancel your vote?'
          )
        );
      }
    ?>
  </p>
<?php else: ?>
  <p><?php echo CHtml::link('Vote', array('/poll/poll/vote', 'id' => $model->id)); ?></p>
<?php endif; ?>
